package active;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;

/**
 * @author 陈华旺
 * @version 1.0
 * @date 2023年11月22日 9:12
 * @Description TODO
 */
@WebServlet("/test12")
public class Test12 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("/test12 - Test12 - service");
//        对数据的处理
//        获取请求参数，查询数据库，数据的筛选验证，业务的异常处理
//        模拟数据
        ArrayList<Double> list = new ArrayList<>();
        for (int i = 0; i <20 ; i++) {
            list.add( Math.random() );
        }
//        模拟数据
//        resp.sendRedirect(req.getContextPath()+"/test12.jsp");

        req.setAttribute("list",list);
//        req.getRequestDispatcher("/test12.jsp").forward(req,resp);
        req.getRequestDispatcher("/WEB-INF/test12-01.jsp").forward(req,resp);
    }
}
